#ifndef METTINGWIDGET_H
#define METTINGWIDGET_H

#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QWidget>
#include "dategroupbox.h"
#include "framelessRoundedwindow.h"
#include "rightframegroupbox.h"
#include "toolbargroupbox.h"

class MettingWidget : public FrameLessRoundedWindow
{
    Q_OBJECT
public:
    explicit MettingWidget(QWidget *parent = nullptr);

signals:

private:
    void addGroupBoxToWidget(QGroupBox *groupBox,
                             const QString &groupObjName,
                             const QString &style);
    void addMinMaxCloaseBtn(QBoxLayout *parentLayout);
    void addGroupInternalComponents(QBoxLayout *vboxLayout,
                                    QToolButton *toolButton,
                                    const QString &toolStyle,
                                    const QString &toolObjectName,
                                    const QString &toolName,
                                    const QString &iconPath,
                                    QSize iconSize);
    void setLayout(QBoxLayout *boxLayout, const QString &ObjName, Qt::Alignment align, int spacing);
    void setQToolButtonProperty(QToolButton *btn,
                                const QString &objectName,
                                const QString &text,
                                const QString &iconFilePath);
    tm getNowTime();
    void addTimeLabel(const tm &local_time, QBoxLayout *boxLayout);

    void bindConnect();
    void changeGroupSize(QGroupBox *group, int width);
    void changeBtnSize(QSize size);
    void setLogoPix(QSize size);

protected:
    void changeEvent(QEvent *event) override;
    void resizeEvent(QResizeEvent *event) override;

private:
    QHBoxLayout *mainHLayout;
    ToolBarGroupBox *toolGroupBox;
    RightFrameGroupBox *rightFrameGouupBox;
    dateGroupBox *dategroupBox;
    QToolButton *closeBtn;
    QToolButton *minBtn;
    QToolButton *maxRecoverBtn;
    QToolButton *videoMetting;
    QToolButton *joinMetting;
    QToolButton *createMetting;
    QToolButton *reserveMetting;
    QToolButton *mettingTool;
    QLabel *spaceLabel;
    QLabel *logLabel;
    QRect mettingWidgetRect;
    QLabel *timeLabel;
    int remainderWidth;
};

#endif // METTINGWIDGET_H
